﻿//Copyright (c) 2010, Andreas Grünwald
//All rights reserved.

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace yaTDL.Core.Converters
{
    public class MultiBoolConverter : IMultiValueConverter
    {

        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            foreach (object o in values)
            {
                if (o is bool || o is bool?)
                {
                    bool b = (bool)o;
                    if (!b) { return false; }
                }
                else
                { return false; }
            }

            return true;

        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
